<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加管理员</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/resource/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/resource/css/mylay.css">
</head>
<body>
    <div style="padding: 20px; background-color: #F2F2F2;">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <form class="layui-form layui-form-pane" action="">
                            <div class="layui-form-item">
                                <label class="layui-form-label">代理账号</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="username" autocomplete="off" placeholder="请输入账号" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">前后台使用相同账号</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" name="password" autocomplete="off" placeholder="请输入密码" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">前后台使用相同密码</div>
                            </div>
                            <!-- <div class="layui-form-item">-->
                            <!--    <label class="layui-form-label">确认密码</label>-->
                            <!--    <div class="layui-input-inline">-->
                            <!--        <input type="password" name="repassword" autocomplete="off" placeholder="请再次输入密码" class="layui-input">-->
                            <!--    </div>-->
                            <!--    <div class="layui-form-mid layui-word-aux">如：admin123</div>-->
                            <!--</div>-->
<!--                            <div class="layui-form-item">-->
<!--                                <label class="layui-form-label">安全码</label>-->
<!--                                <div class="layui-input-inline">-->
<!--                                    <input type="password" name="safe_code" autocomplete="off" placeholder="请输入安全码" class="layui-input">-->
<!--                                </div>-->
<!--                                <div class="layui-form-mid layui-word-aux">仅后台使用</div>-->
<!--                            </div>-->
                            <div class="layui-form-item">
                                <label class="layui-form-label">代理名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="nickname" autocomplete="off" placeholder="代理商名称" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux"></div>
                            </div>
                            <div class="layui-form-item">
                                                        <label class="layui-form-label">代理商状态</label>
                                                        <div class="layui-input-inline">
                                                        	<input type="radio" name="state" value="1" title="正常" checked>
                                                        	<input type="radio" name="state" value="2" title="停用">

                                                        </div>
                            </div>
                            <div class="layui-form-item" style="margin-top: 40px;text-align: center;">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="admins_add_do">立即提交</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

<script src="/resource/layuiadmin/layui/layui.js"></script>
<script src="/resource/js/manage/init_date.js"></script>
<script>
	// JavaScript Document
layui.use(['layer', 'element', 'form', 'upload', 'table'], function(){
    var $    = layui.$
    ,element = layui.element
    ,layer   = layui.layer
    ,form    = layui.form
    ,upload  = layui.upload
    ,table   = layui.table;

	form.render();
	// layer设置
    layer.config({
        skin: 'layui-layer-molv',
        closeBtn: 1,
        shade: 0.3,
        shadeClose: true,
        maxmin: true,
        resize: true
    });

	// 添加管理员
    form.on('submit(admins_add_do)', function(data){
        $.ajax({
            url: "/manage/userAgent/agentAdd",
            data: data.field,
            type: "POST",
            dataType: "json",
            timeout: 15000,
            beforeSend: function(){
                layer.load(1);
            },
            success: function(msg){
                var alertStr = (msg.code == 1) ? '操作成功' : msg.msg;
                layer.msg(alertStr, {time: 2000}, function(){
                    if(msg.code==1){
                        parent.layer.closeAll();
                        parent.layui.table.reload('geRenYeJi');
                    }
                });
            },
            complete: function(){
                layer.closeAll("loading");
            }
        });
        return false;
    });

    // // 编辑管理员
    // form.on('submit(admins_edit_do)', function(data){
    //     $.ajax({
    //         url: "/manage/base/admins_edit",
    //         data: data.field,
    //         type: "POST",
    //         dataType: "json",
    //         timeout: 15000,
    //         beforeSend: function(){
    //             layer.load(1);
    //         },
    //         success: function(msg){
    //             var alertStr = (msg == 1) ? '操作成功' : msg;
    //             layer.msg(alertStr, {time: 2000}, function(){
    //                 if(msg==1){
    //                     parent.layer.closeAll();
    //                     parent.layui.table.reload('admins');
    //                 }
    //             });
    //         },
    //         complete: function(){
    //             layer.closeAll("loading");
    //         }
    //     });
    //     return false;
    // });


});
</script>
</body>
</html>
